
cc.Class({
    extends: cc.Component,

    properties: {
    Text: {
    	default: null,
    	type: cc.Label
    },
    
    //peopleRun:{ default: null, type: cc.Animation },
    
    showTimes: 1, //隐藏时间
    jumpHeight: 100, //跳跃高度
    _isShow: false,
    },
// LIFE-CYCLE CALLBACKS:
	setLabelString: function(str) {
		//這邊直接將我們的Label字串設定為 No.#
		//this.Text.string = ( str );
		//cc.find("background/textCount").getComponent(cc.Label).string = str;
		var	label=this.node.getChildByName("label").getComponent(cc.Label);
		label.string = str;
		
		label.horizontalAlign = cc.Label.HorizontalAlign.CENTER;
		label._forceUpdateRenderData(true); // 这里调用一次手动渲染
		 

	},
	setShowClose: function(boo) {
	
		if(boo==false){
			this.node.getChildByName("closeBtn").active=false;
		}else{
			//什么都不用做
			
		}
	},
	//按钮点击回调
	onConfirBtn: function(callback) {
	
		//console.log("发布按钮点击回调事件");
		this.node.getChildByName("startBtn").on('click', function(event) {
			isShow=0;
			console.log("点击到按钮");
			 if(typeof callback === "function"){
				 callback();
			 }else{
				 cc.log(callback);
			 }
			
		
			
			this.finish(); //先销毁自己
		}, this);
		
		 
		
	},
    // LIFE-CYCLE CALLBACKS:

    onLoad () {
		
		
		
			cc.log("showTips.onLoad")
			window.showtips = this;
		
			// 初始化计时器
			this.timer = 0;
			this.node.active = true;
		
			this.node.getChildByName("closeBtn").on('touchend', function(event) {
				console.log("点击到layout");
				console.log("销毁提示框");
				this.finish();
			}, this);
		
	},
	setJumpAction: function() {
		this.timer = 0;
		// 跳跃
		var jumpDown = cc.moveBy(this.showTimes, cc.v2(0, this.jumpHeight)).easing(cc.easeCubicActionIn());
		var callback = cc.callFunc(this.finish, this);
		return cc.repeat(cc.sequence(jumpDown, callback), 1);
	},
	finish: function() {
		isShow=0;
		this._isShow = false;
		if (this.node) {
			this.node.active = this._isShow;
		}
		this.node.stopAllActions();
		this.node.destroy();
	},
    start () {
		cc.log("showTips.start")
    },

    // update (dt) {},
});
